{% extends "wiki/base.html" %}

{% load timezone_filters %}
{% load i18n %}
{% load wiki %}
{% load wikiurl %}

{% block head_title %}{{ article.title }} {% endblock %}

{% block body %}

    {% wiki_title group %}

    <h2>{% trans "History for article" %} <a href="{% wikiurl article group article %}"> {{ article.title }} </a></h2>

    {% if changes %}
         <form method="post" action="{% wikiurl revert_to_revision group article %}">
            <table class="messages">
                <tr class="tbheader">
                    <th>{% trans "Date" %}</th>
                    <th>{% trans "Editor" %}</th>
                    <th>{% trans "Comment" %}</th>
                    <th>{% trans "Revert to..." %}</th>
                </tr>
                {% for change in changes %}
                    <tr>
                        <td>
                            <a href="{% wikiurl changeset group article change.revision %}">
                            {{ change.modified|localtime:account.timezone|date:_("DATETIME_FORMAT") }}</a>
                        </td>
                        <td>
                            {% if change.is_anonymous_change %}
                                {{ change.editor_ip }}
                            {% else %}
                                <a href="{% url profiles.views.profile change.editor.username %}">{{ change.editor }}</a>
                            {% endif %}
                        </td>
                        <td>
                            {% if change.comment %}<i>'{{ change.comment}}'</i> {% endif %}
                        </td>
                        <td>
                            {% if forloop.first %}
                                {% trans "Current Revision" %}
                            {% else %}
                                <input name="revision" type="radio"
                                       {% if not allow_write %}disabled="disabled"{% endif %}
                                       value="{{ change.revision }}">
                            {% endif %}
                        </td>
                    </tr>
             {% endfor %}
           </table>
           <input type="submit" value="{% trans "Revert" %}" {% if not allow_write %}disabled="disabled"{% endif %}>
         </form>
    {% else %}
        <p>{% trans "No changes in this article" %}</p>
    {% endif %}

{% endblock %}
